﻿@model Material
@{
    ViewBag.Title = "品名维护";
    Layout = "~/Views/Shared/_LayoutForm.cshtml";
}
@Html.HiddenFor(m => m.Id)
@Html.HiddenFor(m => m.RawMaterialId)
@Html.nbTextBoxFor(m => m.Name).Required()
@Html.nbDropDownListFor(m => m.Specification, "MaterialSpec")
@Html.nbTextBoxFor(m => m.Code).Required()
@Html.nbTextBoxFor(m => m.CurrentPrice).Disable().Number()
@Html.nbDropDownListFor(m => m.Unit, "MaterialUnit").Required()
@Html.nbTextBoxFor(m => m.SafeStorage).Number()
@Html.nbDropDownListFor(m => m.Category, "MaterialCategory").Required()
@Html.nbDropDownListFor(m => m.BigClass, "BigClass").Required()
@*@Html.nbTextBoxFor(m => m.ActualSorage).Number()*@
@Html.nbRadioListFor(m => m.NeedProcess, "IsProcess", false)
@*@Html.nbDropDownListFor(m => m.Type, "MaterialType")*@
<div id="div2">
    @Html.nbButtonEditFor(m => m.RawMaterialName, "SetRawMaterial")
    @Html.nbTextBoxFor(m => m.ProcessRate).Number()
</div>
@Html.nbTextAreaFor(m => m.Remark)
<script language="javascript">
    $(document).ready(function () {
        $("input[name='NeedProcess']").bind("change", function () {
            setHide(this.value);
        });
        setHide('@Model.NeedProcess');
        function setHide(value) {
            if (value == "True" || value == "" || value == null) {
                $("#div2").show();
            }
            else {
                $("#div2").hide();
            }
        }
    });
    function SetRawMaterial() {
        OpenModalDialog('@Url.Action("SingleLookUp", "Material", new { p1 = "RawMaterial" })',
        {
            caption: "选择原材料",
            width: 800,
            height: 500,
            type: 2,
            onclose: function (data) {
                if (data) {
                    $("#RawMaterialId").val(data.Id);
                    $("#RawMaterialName").val(data.Name);
                }
            }
        });
    }
</script>
